/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ejb.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Nothing4ever
 */
@Entity
@Table(name = "[Event]")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"),
    @NamedQuery(name = "Event.findById", query = "SELECT e FROM Event e WHERE e.id = :id"),
    @NamedQuery(name = "Event.findByName", query = "SELECT e FROM Event e WHERE e.name = :name"),
    @NamedQuery(name = "Event.findByIntroduction", query = "SELECT e FROM Event e WHERE e.introduction = :introduction"),
    @NamedQuery(name = "Event.findByConductTime", query = "SELECT e FROM Event e WHERE e.conductTime = :conductTime"),
    @NamedQuery(name = "Event.findByCreatedDate", query = "SELECT e FROM Event e WHERE e.createdDate = :createdDate"),
    @NamedQuery(name = "Event.findByFee", query = "SELECT e FROM Event e WHERE e.fee = :fee"),
    @NamedQuery(name = "Event.findBySpeaker", query = "SELECT e FROM Event e WHERE e.speaker = :speaker"),
    @NamedQuery(name = "Event.findByGuest", query = "SELECT e FROM Event e WHERE e.guest = :guest"),
    @NamedQuery(name = "Event.findByPrize", query = "SELECT e FROM Event e WHERE e.prize = :prize"),
    @NamedQuery(name = "Event.findByAddress", query = "SELECT e FROM Event e WHERE e.address = :address"),
    @NamedQuery(name = "Event.findByProcedure", query = "SELECT e FROM Event e WHERE e.procedure = :procedure"),
    @NamedQuery(name = "Event.findByTerm", query = "SELECT e FROM Event e WHERE e.term = :term"),
    @NamedQuery(name = "Event.findByCriteria", query = "SELECT e FROM Event e WHERE e.criteria = :criteria"),
    @NamedQuery(name = "Event.findByActivityId", query = "SELECT e FROM Event e WHERE e.activityId = :activityId")})
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
//    @NotNull
    @Column(name = "Id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    @Size(max = 1000)
    @Column(name = "Name")
    private String name;
    @Size(max = 2000)
    @Column(name = "Introduction")
    private String introduction;
    @Column(name = "Conduct_Time")
    @Temporal(TemporalType.TIMESTAMP)
    private Date conductTime;
    @Column(name = "Created_Date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdDate;
    @Size(max = 1000)
    @Column(name = "Fee")
    private String fee;
    @Size(max = 1000)
    @Column(name = "Speaker")
    private String speaker;
    @Size(max = 1000)
    @Column(name = "Guest")
    private String guest;
    @Size(max = 1000)
    @Column(name = "Prize")
    private String prize;
    @Size(max = 1000)
    @Column(name = "Address")
    private String address;
    @Size(max = 1000)
    @Column(name = "[Procedure]")
    private String procedure;
    @Size(max = 1000)
    @Column(name = "Term")
    private String term;
    @Size(max = 1000)
    @Column(name = "Criteria")
    private String criteria;
    @Column(name = "Activity_Id")
    private Integer activityId;
    @OneToMany(mappedBy = "eventId")
    private Collection<Subcribe> subcribeCollection;
    @OneToMany(mappedBy = "eventId")
    private Collection<Enroll> enrollCollection;
    @OneToMany(mappedBy = "eventId")
    private Collection<News> newsCollection;
    @JoinColumn(name = "Activity_Id", referencedColumnName = "Id", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Activity activity;

    public Event() {
    }

    public Event(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public Date getConductTime() {
        return conductTime;
    }

    public void setConductTime(Date conductTime) {
        this.conductTime = conductTime;
    }

    public Date getCreatedDate() {
        return createdDate;
    }

    public void setCreatedDate(Date createdDate) {
        this.createdDate = createdDate;
    }

    public String getFee() {
        return fee;
    }

    public void setFee(String fee) {
        this.fee = fee;
    }

    public String getSpeaker() {
        return speaker;
    }

    public void setSpeaker(String speaker) {
        this.speaker = speaker;
    }

    public String getGuest() {
        return guest;
    }

    public void setGuest(String guest) {
        this.guest = guest;
    }

    public String getPrize() {
        return prize;
    }

    public void setPrize(String prize) {
        this.prize = prize;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getProcedure() {
        return procedure;
    }

    public void setProcedure(String procedure) {
        this.procedure = procedure;
    }

    public String getTerm() {
        return term;
    }

    public void setTerm(String term) {
        this.term = term;
    }

    public String getCriteria() {
        return criteria;
    }

    public void setCriteria(String criteria) {
        this.criteria = criteria;
    }

    public Integer getActivityId() {
        return activityId;
    }

    public void setActivityId(Integer activityId) {
        this.activityId = activityId;
    }

    @XmlTransient
    public Collection<Subcribe> getSubcribeCollection() {
        return subcribeCollection;
    }

    public void setSubcribeCollection(Collection<Subcribe> subcribeCollection) {
        this.subcribeCollection = subcribeCollection;
    }

    @XmlTransient
    public Collection<Enroll> getEnrollCollection() {
        return enrollCollection;
    }

    public void setEnrollCollection(Collection<Enroll> enrollCollection) {
        this.enrollCollection = enrollCollection;
    }

    @XmlTransient
    public Collection<News> getNewsCollection() {
        return newsCollection;
    }

    public void setNewsCollection(Collection<News> newsCollection) {
        this.newsCollection = newsCollection;
    }

    public Activity getActivity() {
        return activity;
    }

    public void setActivity(Activity activity) {
        this.activity = activity;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Event)) {
            return false;
        }
        Event other = (Event) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ejb.entity.Event[ id=" + id + " ]";
    }
    
}
